package com.itheima.demo03functionalinterface;

import java.util.function.Function;

/**
 * @author chenming
 * Date  2023/6/13 17:19
 * @version 1.0
 * description
 */
public class Demo06FunctionAndThen {
    //场景
    // 使用Lambda表达式将字符串转成数字, 第二个操作将这个数字乘以5
    public static void main(String[] args) {
        getNumber(Integer::parseInt,
                i -> i * 5);
    }

    private static void getNumber(Function<String, Integer> f1,
                                  Function<Integer, Integer> f2) {
        Integer num = f1.andThen(f2).apply("10");
        System.out.println("num=" + num);
    }
}
